#define _CRT_SECURE_NO_WARNINGS 1

#include<stdio.h>
#include<stdlib.h>
#include<string.h>

typedef struct node
{
	int x, y;
}node;

node order[160010];

int step[402][402];
Xdirection[8] = { 1,1,2,2,-1,-1,-2,-2 };
Ydirection[8] = { 2,-2,1,-1,2,-2,1,-1 };

void init_step(int(*step)[402], int row, int col)
{
	for(int i = 1;i<=row;++i)
		for (int j = 1; j <= col; ++j)
		{
			step[i][j] = -1;
		}
}

void bfs(int(*step)[402], node* order,int row, int col)
{
	int first = 0, last = 1;
	int flag = 0;
	int time = 0;
	while(first!=last)
	{
		flag = 0;
		for (int i = 0; i < 8; ++i)
		{
			int xx = order[first].x + Xdirection[i];
			int yy = order[first].y + Ydirection[i];
			if (xx >= 1 && xx <= row)
				if (yy >= 1 && yy <= col)
				{
					if (step[xx][yy] == -1)
					{
						order[last].x = xx;
						order[last].y = yy;
						step[xx][yy] = step[order[first].x][order[first].y]+1;
						++last;
					}
				}
		}
		++first;
	}
}

void print(int(*step)[402], int row, int col)
{
	for(int i = 1;i<=row;++i)
	{
		for (int j = 1; j <= col; ++j)
		{
			printf("%-5d", step[i][j]);
		}
		printf("\n");
	}
}

int main()
{
	int row = 0, col = 0;
	int x = 0, y = 0;
	scanf("%d %d %d %d", &row, &col, &x, &y);
	if (row == 0 || col == 0)
		return 0;
	init_step(step, row, col);
	order[0].x = x;
	order[0].y = y;
	step[x][y] = 0;
	bfs(step, order,row ,col);
	print(step, row, col);
	return 0;
}